#include <bits/stdc++.h>
using namespace std;
#define _S_ 0
#define _C_ 1
#define _U_ 2
typedef long long int LL;
LL f[64],cnt[64][3],tot;
LL solve(LL n,int t){
	if(n<=0) return 0;
	int x=lower_bound(f,f+tot,n)-f;
	if(f[x]>n) x--;
	if(f[x]==n) return cnt[x][t];
	return cnt[x][t]+(t==_C_)+(cnt[x][(t+1)%3]-solve(2*f[x]+1-n,(t+1)%3));
}
int main()
{
	LL T,i,j;
	scanf("%lld",&T);
	cnt[1][_S_]=1;
	f[1]=1;
	for(int i=2;i<64;i++){
		f[i]=(1LL<<i)-1;
		cnt[i][_S_]=cnt[i-1][_S_]+cnt[i-1][_C_];
		cnt[i][_C_]=cnt[i-1][_C_]+cnt[i-1][_U_]+1;
		cnt[i][_U_]=cnt[i-1][_U_]+cnt[i-1][_S_];
		if(f[i]>1e18){
			tot=i+1;
			break;
		}
	}
	while(T--){
		scanf("%lld%lld",&i,&j);
		LL S=solve(j,_S_)-solve(i-1,_S_);
		LL C=solve(j,_C_)-solve(i-1,_C_);
		LL U=j-i+1-S-C;
		printf("%lld %lld %lld\n",S,C,U);
	}
	return 0;
}